<?php
/**
 * 错误信息类
 */

class Error extends Base
{
    protected $action;
    protected $msg;

    public function __construct($msg, $action="stop")
    {
        $this->action = strtolower($action);
        $this->msg = $msg;
        $this->showMsg($msg);
    }

    public function showMsg()
    {
        if($this->action=="stop"){
            throw new Exception($this->msg);
        }elseif($this->action=="ignore"){
            $function = create_function('', " echo '{$this->msg}'; ");
            register_shutdown_function($function);
        }
    }
}


